Ok so on login, i should get a collection of all possible operations
from all roles, and call IsAllowed on them? What if there are hundreds,
is this still ok?
Can they be all wrapped up into a single request (lazily), or will it
be a separate request for each?
On 15 August 2012 15:44:13, Oren Eini (Ayende Rahien) wrote:
> IsAllowed is usually on the global level, and that you can call once:
> var isAllowed = DocumentSession.IsAllowed(__authUser, "Pages/AddNewPage");
>
>
> If it is on a specific document, you have to call it on that.
>
> On Wed, Aug 15, 2012 at 5:37 PM, Paul Hinett
> <
pa...@ukcreativedesigns.com <mailto:
pa...@ukcreativedesigns.com>> wrote:
>
> Sure yes.
>
> Well i think adding different views for different
> permissions/operations could get out of hand very fast. I think it
> will be just a case of some if/else logic within the view to
> show/hide certain elements, there will only be at most 3/4 per
> view so it's manageable. My view models would contain properties
> such as:
>
> CanUpdatePageTitle
> CanDeletePage
> CanUseModerationTools
>
> Oren:
> when you say load the permissions once at login time, what should
> i get? Permissions could come from specific documents, different
> roles the user is associated with and from the
> AuthorizedUser/{user} document too. Do i need to get all this
> (how?) and store into memory/cookie/cache for the current user?
>
>
>
> On 15 August 2012 <tel:2012> 13:39:05, Oren Eini (Ayende Rahien)
> wrote:
>
> inline
>
> On Wed, Aug 15, 2012 <tel:2012> at 3:29 PM, Paul Hinett
> <
pa...@ukcreativedesigns.com
> <mailto:
pa...@ukcreativedesigns.com>
> <mailto:
paul@__
ukcreativedesigns.com
> On Mon, Aug 13, 2012 <tel:2012> <tel:2012 <tel:2012>>
> <mailto:
pa...@ukcreativedesigns.com>
> <mailto:
paul@__
ukcreativedesigns.com
> <mailto:
pa...@ukcreativedesigns.com>>>
>
> wrote:
>
> I have a project which would suit the use of the
> authorization bundle, but i just have a couple of
> basic
> questions to get me off the ground.
>
> I have setup several roles and operations, an example
> operation is 'Pages/AddNewPage', what is best
> practice to
> perform the validation check when adding a new page?
>
> Is it a case of littering my controllers actions
> with the
> following, or is there a more elegant way?
>
> var authUser =
> DocumentSession.Load<User>(__currentUserId);
> var isAllowed = DocumentSession.IsAllowed(__authUser,