Is it possible to change user and role permissions programmatically

Developer Space

Developer Space
Want to extend the Telligent Evolution platform? Collaborate with other developers and product experts here.

Is it possible to change user and role permissions programmatically

This question is answered

I have a large number of groups that I need to modify permissions on.  For example, I need to remove privileges to the registered user and everyone for each group.  Is it possible to do this through the API.  I can't seem to find a hook. 

Verified Answer
  • Hey Steve,

    We ended up using some of the internal Telligent services to accomplish this (not recommended, though, because they're subject to change). 

    Basically, we grabbed an instance of Telligent.Evolution.Components.IRoleService and Telligent.Evolution.Components.ISecurityService to perform some of the programmatic permissions setting magic. The implementations of these interfaces were pulled via the ninject kernel. In fact if you just use Telligent.Common.Services.Get<>() to grab a self bindable class that you write, Ninject/Telligent will automatically wire up those interfaces through constructor injection.

    There's a method on IRoleService named AddNodePermissions that can be used to add a list permission entries specific to a node and role. Note that to remove permissions you have to explicitly set the PermissionEntry to false.

    - Steve Testa, Hyland Software

All Replies
  • Permissions will not be supported via the APIs until 8.0

  • Hey Steve,

    We ended up using some of the internal Telligent services to accomplish this (not recommended, though, because they're subject to change). 

    Basically, we grabbed an instance of Telligent.Evolution.Components.IRoleService and Telligent.Evolution.Components.ISecurityService to perform some of the programmatic permissions setting magic. The implementations of these interfaces were pulled via the ninject kernel. In fact if you just use Telligent.Common.Services.Get<>() to grab a self bindable class that you write, Ninject/Telligent will automatically wire up those interfaces through constructor injection.

    There's a method on IRoleService named AddNodePermissions that can be used to add a list permission entries specific to a node and role. Note that to remove permissions you have to explicitly set the PermissionEntry to false.

    - Steve Testa, Hyland Software

  • I have to highly stress that this is not an ideal solution.  We will support things like this in 8.   Internal code with permissions is more than likely going to change, and I know for sure using Ninject to bind/unbind services will not work as we have removed the ability to do this in 8 all together.