internal static long insObject_CreateUser( Sessionuser sessionUser_in, string login_in, bool selectIdentity_in, ref List<int> errorlist_in, DBConnection con_in ) { long _output = -1L; // ToDos: here! must have permission to create user if (!sessionUser_in.hasPermission( PermissionType.User__insert )) { errorlist_in.Add(ErrorType.user__lack_of_permissions_to_write); return _output; } if (!Sessionuser.checkLogin(login_in, ref errorlist_in)) { return _output; } bool _constraint; _output = DO_CRD_User.insObject( new SO_CRD_User( -1L, login_in, // ToDos: here! encrypt before sending... login_in, // default: password = login sessionUser_in.IDApplication ), selectIdentity_in, out _constraint, con_in ); if (_constraint) { errorlist_in.Add(ErrorType.data__constraint_violation); } else { if (con_in == null) { // assuming NO other (internal) operations are going on errorlist_in.Add(ErrorType.user__successfully_created__WARNING); } } return _output; }
public static bool isSessionGuid_valid( string sessionGuid_in, string ip_forLogPurposes_in, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { if (!isSessionGuid_valid( sessionGuid_in, out sessionGuid_out, out errorlist_out )) { sessionUser_out = null; return false; } if (!UserSession.TryGetValue(sessionGuid_out, out sessionUser_out)) { SBO_LOG_Log.log( null, LogType.error, ErrorType.authentication__expired_guid, -1L, -1, "IP:{0};", ip_forLogPurposes_in ); errorlist_out.Add(ErrorType.authentication__expired_guid); return false; } return true; }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Tag tag_ref, OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Name_in, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permissions . . . if ( !sessionUser_out.hasPermission( false, PermissionType.Tag__insert, PermissionType.Tag__update ) ) { errorlist_out.Add(ErrorType.tag__lack_of_permissions_to_write); return false; } if ( !sessionUser_out.hasPermission(PermissionType.Tag__approve) && ( !tag_ref.Approved_date_isNull || !tag_ref.IFUser__Approved_isNull ) ) { errorlist_out.Add(ErrorType.tag__lack_of_permissions_to_approve); return false; } #endregion // ToDos: here! check parent existence // ToDos: here! check if parent within same application // ToDos: here! check if any other checkings needed ... if (tag_ref.IFTag__parent <= 0) { tag_ref.IFTag__parent_isNull = true; } #region check Tag ... if ( (tx_Name_in == null) || (tx_Name_in.Length == 0) ) { errorlist_out.Add(ErrorType.tag__invalid_name); return false; } else { foreach (SO_DIC__TextLanguage _tx_name in tx_Name_in) { if ( (_tx_name.Text = _tx_name.Text.Trim()).Length == 0 ) { errorlist_out.Add(ErrorType.tag__invalid_name); return false; } } } #endregion return true; }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Author author_ref, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permitions... if ( !sessionUser_out.hasPermition( false, PermitionType.Author__insert, PermitionType.Author__update ) ) { errorlist_out.Add(ErrorType.author__lack_of_permitions_to_write); return false; } if ( !sessionUser_out.hasPermition(PermitionType.Author__approve) && ( !author_ref.Approved_date_isNull || !author_ref.IFUser__Approved_isNull ) ) { errorlist_out.Add(ErrorType.author__lack_of_permitions_to_approve); return false; } #endregion #region check Author... if ( (author_ref.Name = author_ref.Name.Trim()) == "" ) { errorlist_out.Add(ErrorType.author__invalid_name); return false; } #endregion return true; }
private static bool check( #region params... string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Content content_ref, OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Title_in, OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Content_in, OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Subtitle_in, OGen.NTier.Kick.Libraries.DataLayer.Shared.Structures.SO_DIC__TextLanguage[] tx_Summary_in, //bool andApprove_in, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out #endregion ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permissions . . . bool _news__insert = sessionUser_out.hasPermission(PermissionType.News__insert); bool _news__update_Approved = sessionUser_out.hasPermission(PermissionType.News__update_Approved); bool _news__update_Mine_notApproved = sessionUser_out.hasPermission(PermissionType.News__update_Mine_notApproved); if ( !( _news__insert || _news__update_Approved || _news__update_Mine_notApproved ) ) { errorlist_out.Add(ErrorType.news__lack_of_permissions_to_write); return false; } #endregion // #region check Content ... #if !DEBUG if ( (profile_ref.Name = profile_ref.Name.Trim()).Length == 0 ) { errors_out.Add(ErrorType.profile__invalid_name); return false; } #endif //if (andApprove_in) { // if ( // content_ref.Begin_date_isNull // || // content_ref.End_date_isNull // || // (content_ref.Begin_date < content_ref.End_date) // ) { // errors_out.Add(ErrorType.news__invalid_date); // return false; // } else if (credentials_out.hasPermission(PermissionType.News__approve)) { // errors_out.Add(ErrorType.news__lack_of_permissions_to_approve); // return false; // } else { // content_ref.IFUser__Approved = credentials_out.IDUser; // content_ref.Approved_date = DateTime.Now; // //content_in.Begin_date // //content_in.End_date // } //} else { // content_ref.IFUser__Approved_isNull = true; // content_ref.Approved_date_isNull = true; // content_ref.Begin_date // = content_ref.End_date // = datetime_minvalue_; //} // #endregion return true; }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Highlight highlight_ref, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permitions . . . if ( !sessionUser_out.hasPermition( false, PermitionType.Highlight__insert, PermitionType.Highlight__update ) ) { errorlist_out.Add(ErrorType.highlight__lack_of_permitions_to_write); return false; } if ( !sessionUser_out.hasPermition(PermitionType.Highlight__approve) && ( !highlight_ref.Approved_date_isNull || !highlight_ref.IFUser__Approved_isNull ) ) { errorlist_out.Add(ErrorType.highlight__lack_of_permitions_to_approve); return false; } #endregion // ToDos: here! check parent existence // ToDos: here! check if parent within same application // ToDos: here! check if any other checkings needed ... if (highlight_ref.IFHighlight__parent <= 0) { highlight_ref.IFHighlight__parent_isNull = true; } #region check Highlight ... if ( (highlight_ref.Name = highlight_ref.Name.Trim()) == "" ) { errorlist_out.Add(ErrorType.highlight__invalid_name); return false; } #endregion return true; }
public static bool isSessionGuid_valid( string sessionGuid_in, string ip_forLogPurposes_in, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out, out int[] errors_out ) { bool _output = isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out ); errors_out = (_output) ? null : errorlist_out.ToArray(); return _output; }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_NWS_Attachment attachment_ref, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permissions . . . if ( !sessionUser_out.hasPermission( false, PermissionType.News__insert, PermissionType.News__update_Approved, PermissionType.News__update_Mine_notApproved ) ) { errorlist_out.Add(ErrorType.news__lack_of_permissions_to_write); return false; } #endregion #region //check Attachment ... (nothing to check!) #endregion return true; }
internal static void log( Sessionuser usersession_in, int logtype_in, int errortype_in, long idPermition_in, int idApplication_in, string format_in, params string[] args_in ) { SO_LOG_Log _log = new SO_LOG_Log(); #region _log.Message = ...; _log.Message = string.Format(format_in, args_in); if (_log.Message.Length > MessageSize) { _log.Message = _log.Message.Substring(0, MessageSize); } #endregion #region _log.IDUser = ...; if ( (usersession_in == null) || (usersession_in.IDUser <= 0) ) { _log.IFUser_isNull = true; } else { _log.IFUser = usersession_in.IDUser; } #endregion _log.IFLogtype = logtype_in; #region _log.IDErrortype = ...; if (errortype_in == ErrorType.no_error) { _log.IFErrortype_isNull = true; } else { _log.IFErrortype = errortype_in; } #endregion #region _log.IFPermition = ...; if (idPermition_in <= 0) { _log.IFPermition_isNull = true; } else { _log.IFPermition = idPermition_in; } #endregion _log.Stamp = DateTime.Now; _log.IFUser__read_isNull = true; _log.Stamp__read_isNull = true; #region _log.IFApplication = ...; if (idApplication_in <= 0) { _log.IFApplication_isNull = true; } else { _log.IFApplication = idApplication_in; } #endregion DO_LOG_Log.insObject( _log, false, null ); #if DEBUG Console.WriteLine( ".--- Log ---\n{0}{1}{2}|message: {3}\n'-----------", LogType.Items.ContainsKey(logtype_in) ? string.Format( "|log type: {0}\n", LogType.Items[logtype_in].Name ) : "", ErrorType.Items.ContainsKey(errortype_in) ? string.Format( "|error type: {0}\n", ErrorType.Items[errortype_in].Name ) : "", !_log.IFUser_isNull ? string.Format( "|user: {0}\n", _log.IFUser.ToString() ) : "", _log.Message ); #endif }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, ref SO_vNWS_Profile profile_ref, out Guid sessionGuid_out, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { #region check... if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out sessionGuid_out, out sessionUser_out, out errorlist_out )) { return false; } #endregion #region check Permissions . . . if ( !sessionUser_out.hasPermission( false, PermissionType.News__Profile__insert, PermissionType.News__Profile__update ) ) { errorlist_out.Add(ErrorType.news__profile__lack_of_permissions_to_write); return false; } if ( ( !profile_ref.Approved_date_isNull || !profile_ref.IFUser__Approved_isNull ) && !sessionUser_out.hasPermission(PermissionType.News__Profile__approve) ) { errorlist_out.Add(ErrorType.news__profile__lack_of_permissions_to_approve); return false; } #endregion #region check Profile ... if ( (profile_ref.Name = profile_ref.Name.Trim()).Length == 0 ) { errorlist_out.Add(ErrorType.news__profile__invalid_name); return false; } #endregion return true; }
private static bool check( string sessionGuid_in, string ip_forLogPurposes_in, SO_CRD_Profile profile_in, out Sessionuser sessionUser_out, out List<int> errorlist_out ) { Guid _sessionguid; #region check... int[] _errors_out; if (!SBO_CRD_Authentication.isSessionGuid_valid( sessionGuid_in, ip_forLogPurposes_in, out _sessionguid, out sessionUser_out, out errorlist_out, out _errors_out )) { //// no need! //errors_out = _errors.ToArray(); return false; } #endregion #region check Permitions... if ( !sessionUser_out.hasPermition( false, PermitionType.Profile__insert, PermitionType.Profile__update ) ) { errorlist_out.Add(ErrorType.profile__lack_of_permitions_to_write); return false; } #endregion if (profile_in != null) { #region check Profile... if ( (profile_in.Name = profile_in.Name.Trim()) == "" ) { errorlist_out.Add(ErrorType.profile__invalid_name); return false; } #endregion } return true; }