Esempio n. 1
0
 public ServiceResponse<bool> AddTag(ServiceCredentials Credentials, LRI lri, string tag)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
     {
         LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
         DocManager.AddTag(ident, lri, tag);
         ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
         return Rep;
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Esempio n. 2
0
 public ServiceResponse<bool> AddTag(ServiceCredentials Credentials, LRI lri, string tag)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).AddTag(Credentials, lri, tag);
     }
     else
     {
         return new ServiceResponse<bool>(true);
     }
 }
Esempio n. 3
0
 public ServiceResponse<List<string>> GetTags(ServiceCredentials Credentials, LRI lri)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).GetTags(Credentials, lri);
     }
     else
     {
         return new ServiceResponse<List<string>>(true);
     }
 }
Esempio n. 4
0
 public ServiceResponse<bool> AppendChild(ServiceCredentials Credentials, LRI hierarchyLRI, LRI parentLRI, LRI childLRI)
 {
     if (ValidateSession(Credentials, hierarchyLRI) && CanAccessDocument(Credentials, hierarchyLRI, LDocACLPermission.WRITE))
     {
         //todo: validate read access to parent and child lri as well
         DocManager.AppendChild(hierarchyLRI, parentLRI, childLRI);
         ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
         return Rep;
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Esempio n. 5
0
        private bool ValidateSession(ServiceCredentials Credentials, LRI fileLRI)
        {
            bool Valid = true; //todo: change to default of false, uncomment below
            if (fileLRI.SystemDatabase == true) //system databases are not accessible to users in this manner
            {
                Valid = false;
            }
            else
            {
                //validate file access

            }
            //Valid = IDProvider.ValidateParentSession(Credentials.UserLRIString, Credentials.SessionKey);
            return Valid;
        }
Esempio n. 6
0
 public ServiceResponse<bool> UpdateDoc(ServiceCredentials Credentials, LRI lri, List<LDocumentPart> parts)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.WRITE))
     {
         DocManager.UpdateDoc(lri, parts);
         ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
         return Rep;
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Esempio n. 7
0
        public ServiceResponse<LDocumentHeader> SaveNewVersion(ServiceCredentials Credentials, LRI lri)
        {
            //only need read access to copy a file!
            if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
            {
                LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);

                ServiceResponse<LDocumentHeader> Rep = new ServiceResponse<LDocumentHeader>(DocManager.SaveNewVersion(ident, lri));
                if (Rep.ResponseObject == null || Rep.ResponseObject.DocumentLRI == "")
                {
                    Rep.Error = true;
                    Rep.Message = "FILL IN REAL ERROR HERE";
                }
                return Rep;
            }
            else return ServiceResponse<LDocumentHeader>.InvalidCredentails();
        }
Esempio n. 8
0
 //LIdentity UserID, string FQDT, string filename, List<string> Tags, string ParentLRI=""
 public ServiceResponse<LDocumentHeader> NewFile(ServiceCredentials Credentials, string FQDT, string filename, List<string> Tags, string ParentLRI = "")
 {
     if (!filename.Contains("~")) //cannot create a system database entry this way
     {
         if (ValidateSession(Credentials, new LRI(filename)))
         {
             LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
             ServiceResponse<LDocumentHeader> Rep = new ServiceResponse<LDocumentHeader>(DocManager.NewFile(ident, FQDT, filename, Tags, ParentLRI));
             if (((LDocumentHeader)Rep.ResponseObject).DocumentLRI == "")
             {
                 Rep.Error = true;
                 Rep.Message = "Unable to create a new file";
             }
             return Rep;
         }
         else return ServiceResponse<LDocumentHeader>.InvalidCredentails();
     }
     else return ServiceResponse<LDocumentHeader>.InvalidCredentails();
 }
Esempio n. 9
0
 public ServiceResponse<LHierarchyNode> GetPreviousSibling(ServiceCredentials Credentials, LRI hierarchyLRI, LRI childLRI)
 {
     if (ValidateSession(Credentials, hierarchyLRI) && CanAccessDocument(Credentials, hierarchyLRI, LDocACLPermission.READ))
     {
         //todo: validate read access to parent and child lri as well
         LHierarchyNode node = DocManager.GetPreviousSibling(hierarchyLRI, childLRI);
         ServiceResponse<LHierarchyNode> Rep = new ServiceResponse<LHierarchyNode>(node);
         return Rep;
     }
     else return ServiceResponse<LHierarchyNode>.InvalidCredentails();
 }
Esempio n. 10
0
 public TransferUpdate CheckTransferStatus(ServiceCredentials Credentials, string TicketKey)
 {
     return null;
 }
Esempio n. 11
0
 public ServiceResponse<bool> AppendChild(ServiceCredentials Credentials, LRI hierarchyLRI, LRI parentLRI, LRI childLRI)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(hierarchyLRI).AppendChild(Credentials, hierarchyLRI, parentLRI, childLRI);
     }
     else
     {
         return new ServiceResponse<bool>(true);
     }
 }
Esempio n. 12
0
 public ServiceResponse<bool> UpdateDoc(ServiceCredentials Credentials, LRI lri, List<LDocumentPart> parts)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).UpdateDoc(Credentials, lri, parts);
     }
     else
     {
         return new ServiceResponse<bool>(true);
     }
 }
Esempio n. 13
0
 public ServiceResponse<bool> SavePart(ServiceCredentials Credentials, LRI lri, LDocumentPart part, int SequenceNumber)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).SavePart(Credentials, lri, part, SequenceNumber);
     }
     else
     {
         return new ServiceResponse<bool>(true);
     }
 }
Esempio n. 14
0
 public ServiceResponse<LDocumentHeader> SaveNewVersion(ServiceCredentials Credentials, LRI lri)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(lri).SaveNewVersion(Credentials, lri);
     }
     else
     {
         return new ServiceResponse<LDocumentHeader>(true);
     }
 }
Esempio n. 15
0
 public ServiceResponse<LDocumentHeader> NewFile(ServiceCredentials Credentials, string FQDT, string filename, List<string> Tags, string ParentLRI)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(new LRI(LCHARMSConfig.GetSection().LRI)).NewFile(Credentials, FQDT, filename, Tags, ParentLRI);
     }
     else
     {
         return new ServiceResponse<LDocumentHeader>(true);
     }
 }
Esempio n. 16
0
 public ServiceResponse<LDocumentVersionInfo> GetDocVersionInfo(ServiceCredentials Credentials, LRI lri)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public ServiceResponse<List<LDocumentVersionInfo>> GetFileVersionHistory(ServiceCredentials Credentials, LRI lri)
 {
     throw new NotImplementedException();
 }
Esempio n. 18
0
        public List<TransferUpdate> CheckTransferStatuses(ServiceCredentials Credentials)
        {
            List<TransferUpdate> Updates = null;

            return Updates;
        }
Esempio n. 19
0
        public ServiceResponse<List<string>> GetTags(ServiceCredentials Credentials, LRI lri)
        {
            //even if you have a tag applied, if you can't get to the doc, you cant see it.  Too bad.
            if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
            {
                LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
                ServiceResponse<List<string>> Rep = new ServiceResponse<List<string>>(DocManager.GetTags(ident, lri));
                //todo: if we really want, we can check perms on each tag returned here...

                return Rep;
            }
            else return ServiceResponse<List<string>>.InvalidCredentails();
        }
Esempio n. 20
0
 public ServiceResponse<bool> DeleteFileLC(ServiceCredentials Credentials, LRI lri)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 public ServiceResponse<bool> RemoveTag(ServiceCredentials Credentials, LRI lri, string tag)
 {
     if (ValidateSession(Credentials, lri))
     {
         LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
         LRI tagLRI = DocManager.GetTagDocumentLRI(ident, tag);
         if (tagLRI != null)
         {
             if (CanAccessDocument(Credentials, tagLRI, LDocACLPermission.WRITE))
             {
                 DocManager.RemoveTag(ident, lri, tag);
                 ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
                 return Rep;
             }
             else
             {
                 return ServiceResponse<bool>.InvalidCredentails();
             }
         }
         else
         {
             ServiceResponse<bool> Rep = new ServiceResponse<bool>(false);
             Rep.Message = "Tag does not exist";
             return Rep;
         }
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Esempio n. 22
0
        public ServiceResponse<List<LCollection>> GetCollections(ServiceCredentials Credentials, LRI lri)
        {
            if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
            {
                LIdentity ident = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
                ServiceResponse<List<LCollection>> Rep = new ServiceResponse<List<LCollection>>(DocManager.GetCollections(lri));

                return Rep;
            }
            else return ServiceResponse<List<LCollection>>.InvalidCredentails();
        }
Esempio n. 23
0
 public ServiceResponse<bool> SavePart(ServiceCredentials Credentials, LRI lri, LDocumentPart part, int SequenceNumber)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.WRITE))
     {
         DocManager.SavePart(lri, part, SequenceNumber);
         ServiceResponse<bool> Rep = new ServiceResponse<bool>(true);
         return Rep;
     }
     else return ServiceResponse<bool>.InvalidCredentails();
 }
Esempio n. 24
0
 public ServiceResponse<LCHARMS.Collection.LCollection> GetCurrentCollection(ServiceCredentials Credentials, LRI lri, LRI CollectionLRI)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
     {
         ServiceResponse<LCollection> Rep = new ServiceResponse<LCollection>(DocManager.GetCurrentCollection(lri, CollectionLRI));
         if (((LCollection)Rep.ResponseObject) == null)
         {
             Rep.Error = true;
             Rep.Message = "FILL IN REAL ERROR HERE";
         }
         return Rep;
     }
     else return ServiceResponse<LCollection>.InvalidCredentails();
 }
Esempio n. 25
0
 private bool CanAccessDocument(ServiceCredentials Credentials, LRI DocumentLRI, LDocACLPermission Permission)
 {
     bool Valid = true;
     LIdentity id = AuthorizationManager.GetAuthIdentityFromLRI(Credentials.UserLRIString);
     Valid = DocManager.CheckPermission(id, DocumentLRI, Permission);
     return Valid;
 }
Esempio n. 26
0
 public ServiceResponse<LCHARMS.Hierarchy.LHierarchy> GetCurrentCollectionHierarchy(ServiceCredentials Credentials, LRI lri, LRI CollectionLRI)
 {
     throw new NotImplementedException();
 }
Esempio n. 27
0
 public ServiceResponse<LDocumentHeader> GetDocHeader(ServiceCredentials Credentials, LRI lri)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
     {
         ServiceResponse<LDocumentHeader> Rep = new ServiceResponse<LDocumentHeader>(DocManager.GetDocHeader(lri));
         if (((LDocumentHeader)Rep.ResponseObject).DocumentLRI == "")
         {
             Rep.Error = true;
             Rep.Message = "Unable to get document header or document does not exist";
         }
         return Rep;
     }
     else return ServiceResponse<LDocumentHeader>.InvalidCredentails();
 }
Esempio n. 28
0
 public ServiceResponse<DocumentPartResponse> GetDocParts(ServiceCredentials Credentials, LRI lri, int Version)
 {
     if (ValidateSession(Credentials, lri) && CanAccessDocument(Credentials, lri, LDocACLPermission.READ))
     {
         ServiceResponse<DocumentPartResponse> Rep = new ServiceResponse<DocumentPartResponse>(DocManager.GetDocParts(lri, Version));
         if (((DocumentPartResponse)Rep.ResponseObject).Count == 0)
         {
             Rep.Error = true;
             Rep.Message = "FILL IN REAL ERROR HERE";
         }
         return Rep;
     }
     else return ServiceResponse<DocumentPartResponse>.InvalidCredentails();
 }
Esempio n. 29
0
        //login the ID and other IDs associated with the account.
        public ServiceResponse<ServiceCredentials> LoginID(LRI userLRI, string passwordHash, bool LoginAll = true)
        {
            //get account that matches
            if (ClientAccountLookup.ContainsKey(userLRI))
            {
                //login ID
                if(IDMgr.LoginWithHash(userLRI,passwordHash))
                {

                    //get acct
                    ClientAccount acct = ClientAccountLookup[userLRI];
                    //if this is the first login for this account, create a SessionKey
                    if (acct.ClientSessionKey == "")
                    {
                        acct.ClientSessionKey = Guid.NewGuid().ToString();

                    }
                    if (LoginAll)
                    {
                        //todo: if other accounts not logged in, log them in? (LoginAll)
                    }
                    //populate ServiceCredentials
                    ServiceCredentials creds =
                        new ServiceCredentials(userLRI.ToString(), IDMgr.Sessions[userLRI.ToString()].Session.SessionKey);
                    creds.ClientSessionKey = acct.ClientSessionKey;
                    creds.ClientAccountLRI = acct.AccountLRI;
                    ClientAccountLookupBySessionKey[acct.ClientSessionKey] = acct;
                    //return session key in the service response
                    ServiceResponse<ServiceCredentials> resp = new ServiceResponse<ServiceCredentials>();
                    resp.ResponseObject = creds;
                    resp.Message = "OK";
                    return resp;
                } else
                {
                    return new ServiceResponse<ServiceCredentials>(true);
                }
            }
            else
            {
                return new ServiceResponse<ServiceCredentials>(true);
            }
        }
Esempio n. 30
0
 public ServiceResponse<LHierarchyNode> GetPreviousSibling(ServiceCredentials Credentials, LRI hierarchyLRI, LRI childLRI)
 {
     if (CheckSession(Credentials))
     {
         return ConnMgr.GetProvider<ILDataProviderChannel>(hierarchyLRI).GetPreviousSibling(Credentials, hierarchyLRI, childLRI);
     }
     else
     {
         return new ServiceResponse<LHierarchyNode>(true);
     }
 }