public static void Load(IAccessControlList acl, DataTable granted, DataTable denied) { var problems = ValidateTable(granted); if ( problems.Count > 0 ) throw new Exception("Invalid Access Granted Table: " + problems); problems = ValidateTable(denied); if (problems.Count > 0) throw new Exception("Invalid Access Denied Table: " + problems); for (var i = 0; i < granted.Rows.Count; i++) { var row = granted.Rows[i]; var principal = (string) row["Principal"]; var operation = (string)row["Operation"]; var resource = (string)row["Resource"]; acl.Grant(principal,operation,resource); } for (var i = 0; i < denied.Rows.Count; i++) { var row = denied.Rows[i]; var principal = (string)row["Principal"]; var operation = (string)row["Operation"]; var resource = (string)row["Resource"]; acl.Deny(principal, operation, resource); } }
public static void Load(IAccessControlList acl, string grantedFilePath, string deniedFilePath) { var granted = LoadCsvIntoTable(grantedFilePath); var denied = LoadCsvIntoTable(deniedFilePath); Load(acl, granted, denied); }
/// <summary> /// Initializes a new instance of the <see cref="AclPrincipalBase" /> class. /// </summary> /// <param name="acl">The value for the <see cref="AclPrincipalBase.AccessControlList" /> property.</param> /// <param name="syncRoot">The value for the <see cref="TMObject._SYNC" /> field.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="acl" /> and/or <paramref name="syncRoot" /> are <see langword="null" />. /// </exception> protected AclPrincipalBase(IAccessControlList acl, object syncRoot) : base(syncRoot) { if (acl == null) { throw new ArgumentNullException("acl"); } this._ACCESS_CONTROL_LIST = acl; }
public static IHtmlString For <TDomain>(this IAccessControlList lst, SecurityTarget target, string fieldName, Func <HtmlHelper, IJsControlledView> subjSelector) { //Contract.Requires( lst != null ); //Contract.Requires( target != null ); //Contract.Requires( !String.IsNullOrEmpty( fieldName ) ); //Contract.Requires( subjSelector != null ); //Contract.Ensures( //Contract.Result<IHtmlString>() != null ); var sec = lst.Html.ViewContext.HttpContext.Composition().Get <ISecurityService <TDomain> >(); return(lst.With(sec.DefaultAclEditModelFor(target, subjSelector), fieldName)); }
public static bool ContainsRightType <T>(this IAccessControlList acl, T rightType) where T : struct, IConvertible { string rt = rightType.GetFriendlyRightTypeName(); bool found = false; foreach (IAccessControlEntry ace in acl) { if (ace.RightData.FriendlyTypeName.Equals(rt)) { found = true; break; } } return(found); }
public static void Load(IAccessControlList acl, DataTable granted, DataTable denied) { var problems = ValidateTable(granted); if (problems.Count > 0) { throw new Exception("Invalid Access Granted Table: " + problems); } problems = ValidateTable(denied); if (problems.Count > 0) { throw new Exception("Invalid Access Denied Table: " + problems); } for (var i = 0; i < granted.Rows.Count; i++) { var row = granted.Rows[i]; var principal = (string)row["Principal"]; var operation = (string)row["Operation"]; var resource = (string)row["Resource"]; acl.Grant(principal, operation, resource); } for (var i = 0; i < denied.Rows.Count; i++) { var row = denied.Rows[i]; var principal = (string)row["Principal"]; var operation = (string)row["Operation"]; var resource = (string)row["Resource"]; acl.Deny(principal, operation, resource); } }
partial void RemoveAccessControlEntry_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor);
partial void Token_SetCondition(ref IAccessControlList instance, ref String setValue);
partial void SetPermissions_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor, ref Int32 allow, ref Int32 deny, ref Boolean merge);
partial void SetPermissions_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor, Int32 allow, Int32 deny, Boolean merge);
partial void SetAccessControlEntry_PreCondition(IAccessControlList instance, ref IAccessControlEntry accessControlEntry, ref Boolean merge);
partial void SetAccessControlEntry_PostValidate(IAccessControlList instance, IAccessControlEntry accessControlEntry, Boolean merge);
partial void SetAccessControlEntries_PreCondition(IAccessControlList instance, ref IEnumerable <IAccessControlEntry> accessControlEntries, ref Boolean merge);
public static void Load(IAccessControlList acl, string grantedFilePath, string deniedFilePath) { var granted = LoadCsvIntoTable(grantedFilePath); var denied = LoadCsvIntoTable(deniedFilePath); Load(acl,granted,denied); }
public ApplicationServiceBus(IObjectIdService objectIdService, IUtcClockService utcClockService, IAccessControlList accessControlList) { ObjectIdService = objectIdService; UtcClockService = utcClockService; AccessControlList = accessControlList; }
/// <summary> /// Initializes a new instance of the <see cref="AclPrincipalBase" /> class. /// </summary> /// <param name="acl">The value for the <see cref="AclPrincipalBase.AccessControlList" /> property.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="acl" /> is <see langword="null" />. /// </exception> protected AclPrincipalBase(IAccessControlList acl) : this(acl, new object()) { }
partial void RemoveAccessControlEntry_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor);
partial void QueryAccessControlEntries_PreCondition(IAccessControlList instance, ref IEnumerable <IIdentityDescriptor> descriptors);
partial void QueryAccessControlEntries_PostValidate(IAccessControlList instance, IEnumerable <IIdentityDescriptor> descriptors);
partial void InheritPermissions_SetCondition(ref IAccessControlList instance, ref Boolean setValue);
partial void AccessControlEntries_SetCondition(ref IAccessControlList instance, ref IEnumerable <IAccessControlEntry> setValue);
partial void RemovePermissions_PostValidate(IAccessControlList instance, IIdentityDescriptor descriptor, Int32 permissionsToRemove);
partial void RemovePermissions_PreCondition(IAccessControlList instance, ref IIdentityDescriptor descriptor, ref Int32 permissionsToRemove);
partial void AccessControlList_SetCondition(ref IQueryItem instance, ref IAccessControlList setValue);
partial void SetAccessControlEntries_PostValidate(IAccessControlList instance, IEnumerable <IAccessControlEntry> accessControlEntries, Boolean merge);
public void AclSave(IAccessControlList modifiedAcl) { _connector.Request(RequestMethod.ACL_SET, Name, null, Encoding.UTF8.GetBytes(modifiedAcl.ToXmlString()), "application/xml"); }
internal CloudPrincipal(CloudIdentity id, IAccessControlList acl) : base(acl) { this._ID = id; }