public bool IsVisible(ISession session, INakedObject target, IIdentifier member) { var checkViewType = member.IsField ? CheckType.ViewField : CheckType.Action; var checkEditType = member.IsField ? CheckType.EditField : CheckType.Action; var contextView = new AuthorizationContext((ClaimsPrincipal)session.Principal, member.ToIdentityString(IdentifierDepth.ClassName), ((int)checkViewType).ToString()); var contextEdit = new AuthorizationContext((ClaimsPrincipal)session.Principal, member.ToIdentityString(IdentifierDepth.ClassName), ((int)checkEditType).ToString()); // being editable implies visibility return manager.CheckAccess(contextView) || manager.CheckAccess(contextEdit); }
private string GetText(IIdentifier identifier, string type) { string form = identifier.IsField ? Property : Action; string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + ":" + form + "/" + type; return(GetText(key)); }
private string GetText(IIdentifier identifier, string type) { string form = identifier.IsField ? Property : Action; string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + ":" + form + "/" + type; return GetText(key); }
private string GetParameterDescription(IIdentifier identifier, int index) { string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description; return GetText(key); }
public bool IsUsable(ISession session, INakedObject target, IIdentifier member) { var checkType = member.IsField ? CheckType.EditField : CheckType.Action; var context = new AuthorizationContext((ClaimsPrincipal)session.Principal, member.ToIdentityString(IdentifierDepth.ClassName), ((int)checkType).ToString()); return manager.CheckAccess(context); }
private string GetParameterDescription(IIdentifier identifier, int index) { string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description; return(GetText(key)); }
public static string ToIdString(this IIdentifier id) { return(id.ToIdentityString(IdentifierDepth.ClassNameParams)); }
public string GetParameterDescription(IIdentifier identifier, int index, string original) { string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description; return GetText(key, original); }