Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Add custom permissions to a particular role? View modes: 
User avatar
Member
Member
Blasty - 5/19/2010 1:54:25 PM
   
Add custom permissions to a particular role?
I'll try to put this in general terms for my question.

I've got a role called "City Managers", and I want all city Managers to be able to do the same things, and I want them all to work with a particular document called for example "City Work Request". And each of these documents naturally have a city they are assigned to.

Well I want one "City Manager" to only work with Orlando, and Boston. And another "City Manager" to also work with Orlando, but that's it.

Or another "City Manager" to only work with Denver, New York, and Vegas.

So when end-users create these "City Work Request" documents, the Orlando ones will only be seen by the orlando City managers.

Outside of kentico, to solve this I'd create a table that has a userID and LocationID, and when a request came in, I'd take the location ID, and pair it up to the userID of the corresponding "City Manager"

How can i do something like this in Kentico? I saw the User Custom Field area, but I don't think that would work, since one user could be a "City manager' for more then one city.

Hope my illustration makes sense of what I'm trying to do. Thanks.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/22/2010 5:31:38 AM
   
RE:Add custom permissions to a particular role?
Hello,

I'm not sure how exactly you are have implemented the cities. If you are going to have separate section of content tree for each city you could use document level permissions that you would apply for parent item of each section and let its child documents to inherit this setting.
If you use different document type for each city, you could use document type permissions instead.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
Blasty - 5/24/2010 7:49:24 AM
   
RE:Add custom permissions to a particular role?
thanks for the reply Martin, what I think I'm going to do is create a Custom Table, and just leverage it from the code-behind to build my filters when using the tree to select documents.

All city documents in my illustration would be the same document type, just that they contain a field called "Location" which would be what I want to match up to the user.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 5/30/2010 12:02:28 PM
   
RE:Add custom permissions to a particular role?
Hello,

In this case you could create two custom tables - one for storing location and one to storing connections between users and locations (i.e. there would be UserID and LocationID fields in this table), but you would need to modify source code of administration interface to check values in these tables and ensure proper functionality.

Alternatively you could create role for each location, then allow read permission (document-level permission) only for appropriate role for each document and add users that should manage appropriate location into appropriate role.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
Blasty - 6/1/2010 7:50:01 AM
   
RE:Add custom permissions to a particular role?
yeah the two table setup is what I have going. Exactly as you described, In the administration area, I managed to get insert/update drop-downs to auto-load the locations from the second table, but I haven't figured out how to get the table view to show the values from the lookup table instead of the key values in the actual custom table itself.

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 6/6/2010 2:59:51 PM
   
RE:Add custom permissions to a particular role?
Hello,

You could optionally write custom query where you join both tables and then use this query to get data so you get both name and key values.

Best Regards,

Martin Dobsicek

User avatar
Member
Member
Blasty - 6/8/2010 4:13:45 PM
   
RE:Add custom permissions to a particular role?
That's how I'd do it, but I'm trying to do stuff the Kentico way, not sure how to do what you said in Kentico.

Right now the only interface is the custom table interface in the CMS desk running in default mode for the table. I'd imagine what your saying would be outside the CMS_Desk?

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 6/13/2010 2:21:30 PM
   
RE:Add custom permissions to a particular role?
Hello,

Generally you can write custom SQL query in 'Queries' section of custom table administration interface and then execute this query using method - you can find sample code in 'code examples'.

Please note that using this approach (i.e. using custom tables for storing information about permissions) you will need to check data from your custom tables manually in code of administration interface (i.e. customize it). If you want to use some "built-in" way, you can use 'document level' permissions as I advised in my first post of this thread.

Best Regards,

Martin Dobsicek