public override void React(SoftwareMonkeys.SiteStarter.Entities.IEntity entity) { IAuthored authoredEntity = (IAuthored)entity; // Set the author of the entity authoredEntity.Author = AuthenticationState.User; base.React(entity); }
protected virtual bool UserIsAuthor(IAuthored entity) { ActivateStrategy.New(entity).Activate(entity, "Author"); // If the current use is authenticated return(AuthenticationState.IsAuthenticated // and if the current user is the author && entity.Author != null && AuthenticationState.User != null && entity.Author.ID == AuthenticationState.User.ID); }
protected virtual bool UserIsAuthor(IAuthored entity) { ActivateStrategy.New(entity).Activate(entity, "Author"); // If the current use is authenticated return AuthenticationState.IsAuthenticated // and if the current user is the author && entity.Author != null && AuthenticationState.User != null && entity.Author.ID == AuthenticationState.User.ID; }
public override bool IsAuthorised(SoftwareMonkeys.SiteStarter.Entities.IEntity entity) { if (!AuthenticationState.IsAuthenticated) { return(false); } IAuthored authoredEntity = (IAuthored)entity; ActivateStrategy.New(authoredEntity).Activate(authoredEntity, "Author"); return(authoredEntity.IsPublic || (authoredEntity != null && authoredEntity.Author.ID == AuthenticationState.User.ID)); }
private void Load_UserControl(object object_0) { IAuthored authored = object_0 as IAuthored; if ((object_0 is IConfigurable configurable) && (authored != null)) { System.Windows.Controls.UserControl control = configurable.Control; if (control != null) { TabItem item1 = new TabItem { Header = authored.Name, Content = control, Tag = object_0 }; TabItem newItem = item1; this.plugins_table.Items.Add(newItem); } } }
public override bool IsAuthorised(SoftwareMonkeys.SiteStarter.Entities.IEntity entity) { IAuthored authoredEntity = (IAuthored)entity; // If the user is an administrator they are authorised if (AuthenticationState.UserIsInRole("Administrator")) { return(true); } // If the current user is the author if (UserIsAuthor((IAuthored)entity)) { return(true); } else { // otherwise NOT authorised return(false); } }
public void AddEntityToCheck(IAuthored reportObject, CheckReason reason) { add((dynamic)reportObject, reason); }