setPermissions() public method

Sets the permissions for the user for this particular program
public setPermissions ( string perm ) : void
perm string Permission String
return void
Esempio n. 1
0
 private void NewAccessPermission(string guid, int read, int write, string text)
 {
     if (AccessControlList[guid] != null)
     {
         string permission = "";
         if (read == 1)
             permission += "R";
         if (write == 1)
             permission += "W";
         if (read == 0 && write == 0)
         {
             ProgWin temp = (ProgWin)AccessControlList[guid][1];
             temp.Close();
         }
         AccessControlList[guid][0] = permission;
     }
     else
     {
         ProgWin editor = new ProgWin(ProgWin.editorType.collaborator);
         ArrayList list = new ArrayList();
         string permission = "";
         if (read == 1)
             permission += "R";
         if (write == 1)
             permission += "W";
         list.Add(permission);
         list.Add(editor);
         AccessControlList.Add(guid, list);
         editor.loadProgram(text);
         editor.Show();
         editor.setPermissions(permission);
     }
 }
Esempio n. 2
0
      private void AccessThreadStartingPoint()
      {
          ProgWin editor = new ProgWin(ProgWin.editorType.collaborator, SC, IP, Port, AccessString[0], username, Prog + WindowCount.ToString());
          editor.CloseProgramEvent += new ProgWin.CloseProgramEventHandler(editor_CloseProgramEvent);
          ArrayList list = new ArrayList();
          string permission = "";
          if (AccessString[5].ToString() == "true")
              permission += "R";
          if (AccessString[6].ToString() == "true")
              permission += "W";
          list.Add(permission);
          list.Add(editor);
          AccessControlList.Add(AccessString[0], list);
          editor.loadProgram(AccessString[2]);
          foreach (string entry in userList)
          {
              string[] userInfo = entry.Split('|');
              if (userInfo[1].Trim() == AccessString[1])
              {
                  editor.setOwner(userInfo[0].Trim());
                  break;
              }
          }
          //editor.setOwner(s[1]);
          editor.SMObj().setOwner(AccessString[1]);
          editor.Show();
          editor.setUserList(userList);
          editor.setPermissions(permission);
          //editor.SMObj().createTheObjects(s[0], IP, Port);
          editor.SMObj().InitializeThePeer(AccessString[7]);
          editor.SMObj().adder(AccessString[3] + ":" + AccessString[4], AccessString[5], AccessString[6]);

          System.Windows.Threading.Dispatcher.Run();
      }
Esempio n. 3
0
      private void OwnerThreadStartingPoint()
      {
          ProgWin editor = new ProgWin(ProgWin.editorType.owner);
          //owner is the user itself. so pass the username here
          //list of the users in swarm
          //take the program name and send the program name
          editor.setUserList(userList);
          editor.setPermissions("RW");
          editor.loadProgram(programText);
          string pid;
          pid = Guid.NewGuid().ToString();
          ArrayList list = new ArrayList();
          list.Add("RW");
          list.Add(editor);
          AccessControlList.Add(pid, list);
          editor.Show();

          System.Windows.Threading.Dispatcher.Run();
      }
Esempio n. 4
0
      private void OwnerThreadStartingPoint()
      {
          //try
          //{
              string pid;
              pid = Guid.NewGuid().ToString();
              ProgWin editor = new ProgWin(ProgWin.editorType.owner, SC, IP, Port, pid, username, Prog+WindowCount.ToString());
              editor.CloseProgramEvent += new ProgWin.CloseProgramEventHandler(editor_CloseProgramEvent);
              //owner is the user itself. so pass the username here
              //list of the users in swarm
              //take the program name and send the program name
              editor.setUserList(userList);
              editor.setPermissions("RW");
              editor.loadProgram(programText);
              editor.setOwner(username);
              editor.SMObj().setOwner(IP + ":" + Port);
              ArrayList list = new ArrayList();
              list.Add("RW");
              list.Add(editor);
              AccessControlList.Add(pid, list);
              //editor.Owner = this;
              editor.Show();

              System.Windows.Threading.Dispatcher.Run();
          
          //catch(Exception e)
          //{
          //    Console.WriteLine("**********************************************");
          //    Console.WriteLine(e.ToString());
          //    Console.WriteLine("**********************************************");
          //}
      }