internal static IEnumerable <PermissionAction> ParseInitialPermissions(SnSecurityContext context, IList <string> permissionData) { var actions = new Dictionary <int, PermissionAction>(); foreach (var action in permissionData.Select(x => ParsePermissions(context, x))) { var entityId = action.Entries[0].EntityId; if (!actions.TryGetValue(entityId, out var existingAction)) { existingAction = new PermissionAction { EntityId = entityId, Entries = new List <StoredAce>() }; var isEntityInherited = context.IsEntityInherited(entityId); if (isEntityInherited && action.Break) { existingAction.Break = true; } if (!isEntityInherited && !action.Break) { existingAction.Unbreak = true; } actions.Add(entityId, existingAction); } existingAction.Entries.AddRange(action.Entries); } return(actions.Values); }
private static PermissionAction ParsePermissions(SnSecurityContext context, string permissionData) { // "+E1|Normal|+U1:____++++,Normal|+G1:____++++" var a = permissionData.Split('|'); var trimmed = a[0].Trim(); var isInherited = trimmed[0] == '+'; var b = trimmed.Substring(1); var entityId = int.Parse(b); return(new PermissionAction() { Break = !isInherited, Entries = ParseEntries(entityId, permissionData.Substring(a[0].Length + 1)) }); }
/// <summary> /// Returns with a new instance of the SnAclEditor with a SecurityContext as the current context. /// </summary> public static SnAclEditor Create(SnSecurityContext context) { return(new SnAclEditor(context)); }
internal SnAclEditor(SnSecurityContext context) : base(context ?? SecurityHandler.SecurityContext) { }
/// <summary> /// Starts the security subsystem using the passed configuration. /// The method prepares and memorizes the main components for /// creating SecurityContext instances in a fastest possible way. /// The main components are global objects: /// ISecurityDataProvider instance, IMessageProvider instance and SecurityCache instance. /// </summary> public static new void StartTheSystem(SecurityConfiguration configuration) { SecurityContext.StartTheSystem(configuration); _generalContext = new SnSecurityContext(new SystemUser(null)); }
/// <summary> /// Returns with a new instance of the SnAclEditor with a SecurityContext as the current context. /// </summary> public static SnAclEditor Create(SnSecurityContext context, EntryType entryType = EntryType.Normal) { return(new SnAclEditor(context, entryType)); }
internal SnAclEditor(SnSecurityContext context, EntryType entryType = EntryType.Normal) : base(context ?? Providers.Instance.SecurityHandler.SecurityContext, entryType) { }
internal SnAclEditor(SnSecurityContext context, EntryType entryType = EntryType.Normal) : base(context ?? SecurityHandler.SecurityContext, entryType) { }