コード例 #1
0
        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);
        }
コード例 #2
0
        private string GetText(IIdentifier identifier, string type)
        {
            string form = identifier.IsField ? Property : Action;
            string key  = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + ":" + form + "/" + type;

            return(GetText(key));
        }
コード例 #3
0
 private string GetText(IIdentifier identifier, string type) {
     string form = identifier.IsField ? Property : Action;
     string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + ":" + form + "/" + type;
     return GetText(key);
 }
コード例 #4
0
 private string GetParameterDescription(IIdentifier identifier, int index) {
     string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description;
     return GetText(key);
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        private string GetParameterDescription(IIdentifier identifier, int index)
        {
            string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description;

            return(GetText(key));
        }
コード例 #7
0
 public static string ToIdString(this IIdentifier id)
 {
     return(id.ToIdentityString(IdentifierDepth.ClassNameParams));
 }
コード例 #8
0
 public string GetParameterDescription(IIdentifier identifier, int index, string original) {
     string key = identifier.ToIdentityString(IdentifierDepth.ClassNameParams) + Action + "/" + Parameter + (index + 1) + "/" + Description;
     return GetText(key, original);
 }