本文整理汇总了C#中ISecurityObjectId类的典型用法代码示例。如果您正苦于以下问题:C# ISecurityObjectId类的具体用法?C# ISecurityObjectId怎么用?C# ISecurityObjectId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISecurityObjectId类属于命名空间,在下文中一共展示了ISecurityObjectId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InheritFrom
public ISecurityObjectId InheritFrom(ISecurityObjectId objectId) {
if (objectId.ObjectType == type1) {
if (objectId.SecurityId.Equals(2)) return new SecurityObjectId(1, type1);
}
return null;
}
示例2: InheritFrom
public ISecurityObjectId InheritFrom(ISecurityObjectId objectId)
{
int contactId;
int entityId;
EntityType entityType;
if (objectId is Task)
{
var task = (Task)objectId;
contactId = task.ContactID;
entityId = task.EntityID;
entityType = task.EntityType;
}
else if (objectId is RelationshipEvent)
{
var eventObj = (RelationshipEvent)objectId;
contactId = eventObj.ContactID;
entityId = eventObj.EntityID;
entityType = eventObj.EntityType;
}
else
{
return null;
}
if (entityId == 0 && contactId == 0) return null;
if (entityId == 0)
return new Company
{
ID = contactId,
CompanyName = "fakeCompany"
};
// return _daoFactory.GetContactDao().GetByID(contactId);
switch (entityType)
{
case EntityType.Opportunity:
return new Deal
{
ID = entityId,
Title = "fakeDeal"
};
// return _daoFactory.GetDealDao().GetByID(entityId);
case EntityType.Case:
return new Cases
{
ID = entityId,
Title = "fakeCases"
};
// return _daoFactory.GetCasesDao().GetByID(entityId);
}
return null;
}
示例3: RemoveAllAces
public void RemoveAllAces(ISecurityObjectId id)
{
foreach (var r in GetAces(Guid.Empty, Guid.Empty, id).ToArray())
{
RemoveAce(r);
}
}
示例4: GetDenyActions
private DenyResult[] GetDenyActions(ISubject subject, IAction[] actions, ISecurityObjectId objectId, ISecurityObjectProvider securityObjProvider)
{
var denyActions = new List<DenyResult>();
if (actions == null) actions = new IAction[0];
if (subject == null)
{
denyActions = actions.Select(a => new DenyResult(a, null, null)).ToList();
}
else if (subject is ISystemAccount && subject.ID == Constants.CoreSystem.ID)
{
// allow all
}
else
{
ISubject denySubject = null;
IAction denyAction = null;
foreach (var action in actions)
{
var allow = azManager.CheckPermission(subject, action, objectId, securityObjProvider, out denySubject, out denyAction);
if (!allow)
{
denyActions.Add(new DenyResult(action, denySubject, denyAction));
break;
}
}
}
return denyActions.ToArray();
}
示例5: GetObjectRoles
public IEnumerable<IRole> GetObjectRoles(ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
{
// Constants.Everyone
// if (_daoFactory.GetManagerDao().GetAll(false).Contains(ASC.Core.CoreContext.UserManager.GetUsers(account.ID)))
// return new Action[]
throw new NotImplementedException();
}
示例6: InheritFrom
public ISecurityObjectId InheritFrom(ISecurityObjectId objectId)
{
int calId;
if (int.TryParse(this.CalendarId, out calId))
return new Calendar() { Id = this.CalendarId };
return null;
}
示例7: GetObjectRoles
public IEnumerable<ASC.Common.Security.Authorizing.IRole> GetObjectRoles(ASC.Common.Security.Authorizing.ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
{
List<IRole> roles = new List<IRole>();
if (account.ID.Equals(this.OwnerId))
roles.Add(ASC.Common.Security.Authorizing.Constants.Owner);
return roles;
}
示例8: IsPrivate
private static bool IsPrivate(ISecurityObjectId entity)
{
var entityAces = CoreContext.AuthorizationManager.GetAcesWithInherits(Guid.Empty, _actionRead.ID, entity, GetCRMSecurityProvider());
return entityAces.Count() > 1;
}
示例9: GetObjectRoles
public IEnumerable<IRole> GetObjectRoles(ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
{
var roles = new List<IRole>();
if (Equals(account.ID, this.UserID))
{
roles.Add(Constants.Owner);
}
return roles;
}
示例10: GetObjectRoles
public IEnumerable<IRole> GetObjectRoles(ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
{
var roles = new List<IRole>();
if (blogOwner != null && blogOwner.ID.Equals(account.ID))
{
roles.Add(ASC.Common.Security.Authorizing.Constants.Owner);
}
return roles;
}
示例11: GetAcl
public IEnumerable<Ace> GetAcl(ISubject subject, IAction action, ISecurityObjectId objectId, ISecurityObjectProvider secObjProvider)
{
if (subject == null) throw new ArgumentNullException("subject");
if (action == null) throw new ArgumentNullException("action");
return CoreContext.AuthorizationManager
.GetAcesWithInherits(subject.ID, action.ID, objectId, secObjProvider)
.Select(r => new Ace(r.ActionId, r.Reaction));
}
示例12: GetObjectRoles
public IEnumerable<ASC.Common.Security.Authorizing.IRole> GetObjectRoles(ASC.Common.Security.Authorizing.ISubject account, ISecurityObjectId objectId, SecurityCallContext callContext)
{
var roles = new List<IRole>();
if (!Guid.Empty.Equals(Object.OwnerID) && Object.OwnerID.Equals(account.ID))
{
roles.Add(ASC.Common.Security.Authorizing.Constants.Owner);
}
return roles;
}
示例13: CheckPermission
public bool CheckPermission(ISubject subject, IAction action, ISecurityObjectId objectId,
ISecurityObjectProvider securityObjProvider, out ISubject denySubject,
out IAction denyAction)
{
if (subject == null) throw new ArgumentNullException("subject");
if (action == null) throw new ArgumentNullException("action");
var acl = GetAzManagerAcl(subject, action, objectId, securityObjProvider);
denySubject = acl.DenySubject;
denyAction = acl.DenyAction;
return acl.IsAllow;
}
示例14: Demand
public void Demand(ISubject subject, ISecurityObjectId objectId, ISecurityObjectProvider securityObjProvider, params IAction[] actions)
{
var denyActions = GetDenyActions(subject, actions, objectId, securityObjProvider);
if (0 < denyActions.Length)
{
throw new AuthorizingException(
subject,
Array.ConvertAll(denyActions, r => r.TargetAction),
Array.ConvertAll(denyActions, r => r.DenySubject),
Array.ConvertAll(denyActions, r => r.DenyAction));
}
}
示例15: AzObjectSecurityProviderHelper
public AzObjectSecurityProviderHelper(ISecurityObjectId objectId, ISecurityObjectProvider secObjProvider)
{
if (objectId == null) throw new ArgumentNullException("objectId");
currObjIdAsProvider = false;
currObjId = objectId;
currSecObjProvider = secObjProvider;
if (currSecObjProvider == null && currObjId is ISecurityObjectProvider)
{
currObjIdAsProvider = true;
currSecObjProvider = (ISecurityObjectProvider) currObjId;
}
callContext = new SecurityCallContext();
}