snowflake - trigger/stream on the users view - snowflake-cloud-data-platform

I would like to create a stream on the user view to catch the changes but I am getting error: Change tracking is not supported on queries with joins of type '[LEFT_OUTER_JOIN]'.
I need to implement such case:
When a new user is created I want to create a schema in the database for that user.
Maybe you can suggest me some solution?

Related

Is it possible to save additonal data in Sessions Table in CakePHP 3?

I need to do the following tasks in CakePHP 3:
Logout users manually
Limit the number of sessions to one per user
I'm using database sessions to accomplish that. Is it possible to save additional data in sessions table? If yes, could you give me an example please?
The session database model is a cake model like all the other models, which means you can interact with it, in the same way, by adding new columns to that table and/or deleting sessions if needed. Use the model object to update delete entities in that table (I assume you're talking about cakephp 3.x)
Limiting the number of sessions to one per user can be tricky as sessions are created even if a user is not logged in. So you will have "user-less" sessions in your database as well.
Suggested way to tackle this
When a user logs in, get the current session ID and find the row in the session table that needs to be updated to include the username
At this time you may also want to delete the other rows that have the same user name, effectively destroying all the other sessions for this user.

How to add custom field to Asp Net Membership provider?

I would like to add a string field "SerialNumber" in my User profile table in SQL with ASP Net membership provider. I can add field directly from the SQL Database but is that right to do it? I tried this article How to assign Profile values? but at the end it gives a compilation error which is Cannot convert type 'System.Web.Profile.ProfileBase' to 'ProfileCommon'.
Please help
you can use the Profile Provider for this.
Alternatively, you could create your own table(s) that store extra user-related data. But you have to create your own tables and creating the code to get and save data to and from these tables, so you can use custom tables in this way allows for greater flexibility and maintainability than the Profile Provider (specifically, the default Profile Provider, SqlProfileProvider, which stores profile data in an inefficient, denormalized manner).
Take a look at this tutorial

User Management in Web Application ( Angularjs, spring, hibernate )

Logical Question
Backend implementation
I am implementing User Management Module in Web application. I have three table User, Role and UserInterce. The user table has ManyToMany relationship with role table and Role table has ManyToMany relationship with User Interface table. So whenever Server return user object, the system will verify it's role and that role has access right to which user interface.
this is background overview of backend implementation.
Front End implementation
Whenever user login into the system,server will return user object. I want to implement access control in form basis. e.g. emp role do not have access right to add button where admin role has access right to add button. To implement form based access control i would require to create another table at server side which has information about ui fields and that will be has relationshiop with User Interface table.
can some one provide better way of doing same thing logically ?
If you don't need to have possibility to edditing role's permissions in runtime, the best way is to use spring JSP tag library and build your frontend using spring security tags
http://docs.spring.io/spring-security/site/docs/3.0.x/reference/taglibs.html
Otherwise, using some table for storing your permisssions is the only option to do that

How can I get userid from an Active Directory user in Sitecore?

We're using Active Directory to manage some of the accounts in our Sitecore instance. In the database the usernames are in the domain\username format (as you'd expect).
In Sitecore, I can do
var user = User.FromName(item["__Created by"], true)
and I get back a user object, but I can't seem to get the Guid associated with the user in the aspnet_Users table.
Other than using AD, we're not doing anything funny with the membership provider.
Edit: I probably should have stated: I've got the ProviderUserKey but it's not the UserId from the aspnet_Users table as it would be if this were using the membership provider that comes with Sitecore, it's very different (it's of type System.Security.Principal.IdentityReference.SecurityIdentifier if anyone is interested)
This is not possible without directly querying the database. You could write an extension method that queries the database for the User, but I would recommend not using a database field that is intentionally hidden/abstracted by the API. If you provide more info on why you wanted to get the UserId, we might be able to help you find some alternatives.

Is there a way to persist user settings to a database in WPF

I'm exploring all the options to persist user settings. The artilce in the url User-specific settings files for a windows form application: local xml file or database convinced me to store the settings into a db as my application is a standalone communicating with a DB. Is there any provider class like RegistrySettingsProvider to persist the data into database.
No - there isn't anything directly comparable. I'd look at the user settings as just another kind of data to store in the database. Use the same methods to store the user settings as you do the rest of the application's data.
I recommend NHibernate for your data layer. Just set up a mapping file and the database table and let NHibernate handle persisting your data to the database. Use that for all your database storage throughout the app and see how little database code you need to write.
I afraid no because your use setting is very application specific and hence there is no general to do the persistence.
You might want to consider one of the following two approaches:
Serialize your user setting class as a string, and store that string as a blob text column in one of your table.
Create a table schema that maps to your user setting, and persist the setting according to each column.
I would prefer the first approach because of its flexibility.

Resources