Ejemplo n.º 1
0
        public static int SetFilePermissions(int packageId, string path, UserPermission[] users, bool resetChildPermissions)
        {
            // check account
            int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);

            if (accountCheck < 0)
            {
                return(accountCheck);
            }

            // place log record
            TaskManager.StartTask("FILES", "SET_PERMISSIONS", path, packageId);

            try
            {
                OS.OperatingSystem os       = GetOS(packageId);
                string             fullPath = GetFullPackagePath(packageId, path);

                // get users OU defined on web server
                string usersOU = WebServerController.GetWebUsersOU(packageId);

                os.GrantGroupNtfsPermissions(fullPath, users, usersOU, resetChildPermissions);

                return(0);
            }
            catch (Exception ex)
            {
                throw TaskManager.WriteError(ex);
            }
            finally
            {
                TaskManager.CompleteTask();
            }
        }