public void addPermission(Permission permission) { if (this.Permissions == null) { this.Permissions = new List<Permission>(); } this.Permissions.Add(permission); permission.addUser(this); }
private static Permission generatePermisson( ModelContext context, string name, bool state ) { try { Permission permission = new Permission() { Name = name, Credential = generateCredantial( context, state ), Task = generateTask( name ) }; context.PermissionSet.AddOrUpdate( p => p.Name, permission ); Log.DebugFormat( $"generatePermisson: {permission.toString()}\nDONE" ); return permission; } catch ( Exception e ) { Log.Error( "generatePermisson", e ); return null; } }
public void removPermission(Permission permission) { if (this.Permissions != null && this.Permissions.Contains(permission)) { this.Permissions.Remove(permission); permission.removUser(this); } }
public IUser(Permission permission) : base() { this.addPermission(permission); }