Proprietà IVSSDatabase.ProjectRightsEnabled
Ottiene o imposta un valore che indica se i diritti per i progetti sono attivati.
Spazio dei nomi: Microsoft.VisualStudio.SourceSafe.Interop
Assembly: Microsoft.VisualStudio.SourceSafe.Interop (in microsoft.visualstudio.sourcesafe.interop.dll)
Sintassi
'Dichiarazione
Property ProjectRightsEnabled As Boolean
'Utilizzo
Dim instance As IVSSDatabase
Dim value As Boolean
value = instance.ProjectRightsEnabled
instance.ProjectRightsEnabled = value
bool ProjectRightsEnabled { get; set; }
property bool ProjectRightsEnabled {
bool get ();
void set ([InAttribute] bool pEnabled);
}
/** @property */
boolean get_ProjectRightsEnabled ()
/** @property */
void set_ProjectRightsEnabled (/** @attribute InAttribute() */ boolean pEnabled)
function get ProjectRightsEnabled () : boolean
function set ProjectRightsEnabled (pEnabled : boolean)
Valore proprietà
true se i diritti per i progetti sono attivati, altrimenti false.
Note
[IDL]
HRESULT ProjectRightsEnabled([out, retval] boolean *pEnabled);
HRESULT ProjectRightsEnabled([in] boolean pEnabled);
La proprietà ProjectRightsEnabled attiva i diritti per i progetti per tutti i nuovi utenti di Visual SourceSafe. Solo un amministratore può accedere a questa proprietà. Se un altro utente tenta di accedervi, verrà generato un errore di run-time.
Esempio
Nell'esempio riportato di seguito viene illustrato come utilizzare la proprietà ProjectRightsEnabled per attivare i diritti per i progetti per un utente IVSSUser.
[C#]
using System;
using Microsoft.VisualStudio.SourceSafe.Interop;
public class IVSSTest
{
private static string GetUsername()
{
Console.Write("Enter Username: ");
return Console.ReadLine();
}
private static string GetPassword()
{
Console.Write("Enter Password: ");
return Console.ReadLine();
}
public static void Main()
{
// Create a VSSDatabase object.
IVSSDatabase vssDatabase = new VSSDatabase();
// Only SourceSafe Admin can access Project Rights.
vssDatabase.Open(@"C:\VSSTestDB\srcsafe.ini",
GetUsername(), GetPassword());
//Enable ALL DefaultProjectRights
vssDatabase.ProjectRightsEnabled = true;
vssDatabase.DefaultProjectRights = (int)VSSRights.VSSRIGHTS_ALL;
// Display DefaultProjectRights and ProjectRightsEnabled
string rightsOutput = "New User Rights: ";
switch(vssDatabase.DefaultProjectRights)
{
case 0:
rightsOutput += "No Rights";
break;
case (int)VSSRights.VSSRIGHTS_READ:
rightsOutput += "Read";
break;
case (int)VSSRights.VSSRIGHTS_READ +
(int)VSSRights.VSSRIGHTS_CHKUPD:
rightsOutput += "Read/Check Out/Check In";
break;
case (int)VSSRights.VSSRIGHTS_READ +
(int)VSSRights.VSSRIGHTS_CHKUPD +
(int)VSSRights.VSSRIGHTS_ADDRENREM:
rightsOutput += "Read/Check Out/Check In/Add/Rename/Delete";
break;
case (int)VSSRights.VSSRIGHTS_ALL:
rightsOutput += "Read/Check Out/Check" +
" In/Add/Rename/Delete/Destroy";
break;
default:
throw new Exception("Unknown VSS Database Right");
}
Console.WriteLine(rightsOutput);
Console.WriteLine("Project Rights Enabled: " +
vssDatabase.ProjectRightsEnabled);
}
}
Output:
New User Rights: Read/Check Out/Check In/Add/Rename/Delete/Destroy
Project Rights Enabled: True
Vedere anche
Riferimenti
Interfaccia IVSSDatabase
Membri IVSSDatabase
Spazio dei nomi Microsoft.VisualStudio.SourceSafe.Interop
Proprietà IVSSDatabase.DefaultProjectRights